<!--  -->
<template>
  <div class="container">
    <topTitle :titleName="'救援记录'" :iconName="'ios-podium-outline'" :path="'/userManage'"></topTitle>
    <div class="content">
      <Tabs value="name1" @on-click="switchTap" :animated="false">
        <TabPane label="救援列表" name="name1">
          <div class="functionMenu">
            <div class="left" style="width:90%">
              <Button
                type="primary"
                class="search"
                icon="md-add"
                @click="addData"
                v-if="filter(routerList,routerName+'/add')"
              >添加</Button>
              <Select
                v-model="param.status"
                clearable
                style="width:120px;margin-right:13px;margin-left:50px"
                placeholder="任务状态"
              >
                <Option
                  v-for="item in orderList"
                  :value="item.id"
                  :label="item.name"
                  :key="item.id"
                >{{ item.name }}</Option>
              </Select>
              <Select
                clearable
                v-model="param.insure_id"
                placeholder="保险公司"
                :label-in-value="true"
                style="width:150px;margin-right:13px"
              >
                <Option
                  v-for="item in companyList"
                  :value="item.id"
                  :label="item.title"
                  :key="item.id"
                >{{ item.title }}</Option>
              </Select>
              <Select
                v-model="param.fleet_id"
                placeholder="车队"
                clearable
                style="width:130px;margin-right:13px"
                :label-in-value="true"
              >
                <Option
                  v-for="item in carTeamList"
                  :value="item.id"
                  :label="item.title"
                  :key="item.id"
                >{{ item.title }}</Option>
              </Select>
              <Input
                v-model="param.user"
                clearable
                placeholder="用户"
                style="width:130px;margin-right:13px"
              />
              <DatePicker
                type="daterange"
                size="default"
                format="yyyy-MM-dd"
                placement="bottom-end"
                placeholder="选择日期"
                style="width: 200px"
                @on-change="selectDate"
              ></DatePicker>
              <Input
                class="gw"
                clearable
                style="width:170px;margin-left:15px;margin-right:15px"
                v-model="param.keyword"
                placeholder="订单号、车牌号"
              ></Input>
              <Button type="primary" class="search" icon="ios-search" @click="searchData">搜索</Button>
            </div>
            <div class="right" style="width:10%">
              <Button
                type="error"
                @click="exportData"
                v-if="filter(routerList,routerName+'/export')"
              >导出</Button>
            </div>
          </div>
          <Table
            ref="myTable"
            border
            :columns="tableTitle"
            :data="tableData"
            style="margin-top:50px"
          >
            <template slot-scope="{ row, index }" slot="action">
              <div
                class="update"
                style="display:inline-block;cursor: pointer;margin-left:10px;"
                @click="lookDetail(row)"
              >
                <Icon type="ios-eye" color="#409EFF" />
                <span style="color:#409EFF">详情</span>
              </div>
              <div
                class="update"
                style="display:inline-block;cursor: pointer;margin-left:10px;"
                v-if="filter(routerList,routerName+'/edit')"
                @click="updateData(row)"
              >
                <Icon type="md-color-filter" color="#409EFF" />
                <span style="color:#409EFF">编辑</span>
              </div>
              <div
                class="update"
                style="display:inline-block;cursor: pointer;margin-left:10px;"
                v-if="filter(routerList,routerName+'/assign')&&(row.status==0||row.status==120)"
                @click="assign(row)"
              >
                <Icon type="ios-paper-plane" color="#409EFF" />
                <span style="color:#409EFF">指派</span>
              </div>
              <div
                class="update"
                style="display:inline-block;cursor: pointer;margin-left:10px;"
                v-if="(filter(routerList,routerName+'/cancel') && row.status != 122) && (filter(routerList,routerName+'/cancel') && row.status != 666) && (filter(routerList,routerName+'/cancel') && row.status != 133)"
                @click="cancel(row.id)"
              >
                <Icon type="md-close" color="#409EFF" />
                <span style="color:#409EFF">取消</span>
              </div>
            </template>
          </Table>
          <page
            :total="total"
            :currentPage="param.page"
            ref="page"
            :switchPageIndex="switchPageIndex"
            :switchPageSize="switchPageSize"
          ></page>
        </TabPane>
        <TabPane label="放空列表" name="name2">
          <div class="functionMenu">
            <div class="left" style="width:80%">
              <Select
                v-model="fangkongParam.fleet_id"
                placeholder="车队"
                clearable
                transfer
                @on-change="selectCarTeam"
                style="width:130px;margin-right:13px"
                :label-in-value="true"
              >
                <Option
                  v-for="item in carTeamList"
                  :value="item.id"
                  :label="item.title"
                  :key="item.id"
                >{{ item.title }}</Option>
              </Select>
              <Select
                :label-in-value="true"
                clearable
                transfer
                filterable
                style="width:130px;margin-right:13px"
                placeholder="司机"
                v-model="fangkongParam.uid"
              >
                <Option
                  v-for="(item,index) in driverList"
                  :value="item.id"
                  :label="item.nickname"
                  :key="index"
                >{{ item.nickname }}</Option>
              </Select>
              <DatePicker
                type="daterange"
                size="default"
                format="yyyy-MM-dd"
                placement="bottom-end"
                transfer
                placeholder="选择日期"
                style="width: 200px;margin-right:20px"
                @on-change="selectDate2"
              ></DatePicker>
              <Button type="primary" class="search" icon="ios-search" @click="searchData2">搜索</Button>
            </div>
            <div class="right" style="width:20%">
              <Button
                type="error"
                @click="exportData2"
                v-if="filter(routerList,routerName+'/export')"
              >导出</Button>
            </div>
          </div>
          <Table
            ref="myTable"
            border
            :columns="fangkongTitle"
            :data="fangkongList"
            style="margin-top:50px"
          ></Table>
          <page
            :total="total2"
            :currentPage="fangkongParam.page"
            :switchPageIndex="switchPageIndex2"
            :switchPageSize="switchPageSize2"
          ></page>
        </TabPane>

        
        <TabPane label="超时列表" name="name3">
          <div class="functionMenu">
            <div class="left" style="width:80%">
              <Select
                v-model="fangkongParam.fleet_id"
                placeholder="车队"
                clearable
                transfer
                @on-change="selectCarTeam"
                style="width:130px;margin-right:13px"
                :label-in-value="true"
              >
                <Option
                  v-for="item in carTeamList"
                  :value="item.id"
                  :label="item.title"
                  :key="item.id"
                >{{ item.title }}</Option>
              </Select>
              <Select
                :label-in-value="true"
                clearable
                transfer
                filterable
                style="width:130px;margin-right:13px"
                placeholder="司机"
                v-model="fangkongParam.uid"
              >
                <Option
                  v-for="(item,index) in driverList"
                  :value="item.id"
                  :label="item.nickname"
                  :key="index"
                >{{ item.nickname }}</Option>
              </Select>
              <DatePicker
                type="daterange"
                size="default"
                format="yyyy-MM-dd"
                placement="bottom-end"
                transfer
                placeholder="选择日期"
                style="width: 200px;margin-right:20px"
                @on-change="selectDate2"
              ></DatePicker>
              <Button type="primary" class="search" icon="ios-search" @click="searchData2">搜索</Button>
            </div>
            <div class="right" style="width:20%">
              <Button
                type="error"
                @click="exportData3"
                v-if="filter(routerList,routerName+'/export')"
              >导出</Button>
            </div>
          </div>
          <Table
            ref="myTable"
            border
            :columns="overTimeTitle"
            :data="fangkongList"
            style="margin-top:50px"
          ></Table>
          <page
            :total="total2"
            :currentPage="fangkongParam.page"
            :switchPageIndex="switchPageIndex2"
            :switchPageSize="switchPageSize2"
          ></page>
        </TabPane>
        <TabPane label="异常列表" name="name4">
          <div class="functionMenu">
            <div class="left" style="width:80%">
              <!-- <Select
                v-model="fangkongParam.fleet_id"
                placeholder="车队"
                clearable
                transfer
                @on-change="selectCarTeam"
                style="width:130px;margin-right:13px"
                :label-in-value="true"
              >
                <Option
                  v-for="item in carTeamList"
                  :value="item.id"
                  :label="item.title"
                  :key="item.id"
                >{{ item.title }}</Option>
              </Select>
              <Select
                :label-in-value="true"
                clearable
                transfer
                filterable
                style="width:130px;margin-right:13px"
                placeholder="司机"
                v-model="fangkongParam.uid"
              >
                <Option
                  v-for="(item,index) in driverList"
                  :value="item.id"
                  :label="item.nickname"
                  :key="index"
                >{{ item.nickname }}</Option>
              </Select> -->
              <!-- <DatePicker
                type="daterange"
                size="default"
                format="yyyy-MM-dd"
                placement="bottom-end"
                transfer
                placeholder="选择日期"
                style="width: 200px;margin-right:20px"
                @on-change="selectDate2"
              ></DatePicker> -->
              <Input
                class="gw"
                clearable
                style="width:170px;margin-right:15px"
                v-model="abnormalParam.keyword"
                placeholder="订单号、车牌号"
              ></Input>
              <Button type="primary" class="search" icon="ios-search" @click="searchData3">搜索</Button>
            </div>
            <div class="right" style="width:20%">
              <!-- <Button
                type="error"
                @click="exportData3"
                v-if="filter(routerList,routerName+'/export')"
              >导出</Button> -->
            </div>
          </div>
          <Table
            ref="myTable"
            border
            :columns="abnormalTitle"
            :data="abnormalList"
            style="margin-top:50px"
          >
            <template slot-scope="{ row, index }" slot="action">
          <div
            class="update"
            style="display:inline-block;cursor: pointer;margin-left:10px;"
            v-if="row.limit_status == 0"
            @click="relieve(row.id)"
          >
            <Icon type="md-color-filter" color="#409EFF" />
            <span style="color:#409EFF">解除异常</span>
          </div>
        </template>
          </Table>
          <page
            :total="total"
            :currentPage="fangkongParam.page"
            :switchPageIndex="switchPageIndex3"
            :switchPageSize="switchPageSize3"
          ></page>
        </TabPane>
      </Tabs>
      
      <rescueHistoryModal
        :lookAttribute="lookInfo"
        :list="rowList"
        @refreshData="getRescueHistoryList"
      ></rescueHistoryModal>
      
      <assignModal :lookAttribute="lookInfo2" :list="rowList2" @refreshData="getRescueHistoryList"></assignModal>
      
      <updateRescueHistoryModal
        :lookAttribute="lookInfo3"
        :list="rowList3"
        @refreshData="getRescueHistoryList"
      ></updateRescueHistoryModal>
      
      <addRescueTask
        :lookAttribute="lookInfo4"
        :list="rowList4"
        @refreshData="getRescueHistoryList"
      ></addRescueTask>

      <Carousel v-model="value1" class="slideshow" v-if="oepnSlider" style="text-align:center;">
        <CarouselItem v-for="(item,index) in imgs" :key="index">
          <div class="demo-carousel">
            <img
              :src="'http://www.1c1l.com'+item"
              alt
              style="height:400px;width:auto;cursor:pointer;margin: 0 auto"
            />
          </div>
        </CarouselItem>
      </Carousel>
      
      <div class="maskModal" v-if="oepnSlider == true" @click="oepnSlider = false"></div>
      
    </div>
  </div>
</template>

<script>
//这里可以导入其他文件（比如：组件，工具js，第三方插件js，json文件，图片文件等等）
//例如：import 《组件名称》 from '《组件路径》';
import topTitle from "@$@/components/universal/title";
import page from "@$@/components/Page/page"; //分页
import rescueHistoryModal from "@$@/components/WayRescue/rescueHistoryModal";
import assignModal from "@$@/components/WayRescue/assignModal";
import updateRescueHistoryModal from "@$@/components/WayRescue/updateRescueHistoryModal";
import addRescueTask from "@$@/components/WayRescue/addRescueTask";
import mxRadioRoot from "@$@/mixin/filter";
export default {
  //import引入的组件需要注入到对象中才能使用
  components: {
    topTitle,
    page,
    rescueHistoryModal,
    assignModal,
    updateRescueHistoryModal,
    addRescueTask,
  },
  data() {
    //这里存放数据
    return {
      param: {
        page: 1,
        pagesize: 10,
        status: "",
        insure_id: null,
        fleet_id: null,
        uid: null,
        start_time: "",
        end_time: "",
        keyword: "",
      },
      // 表格
      tableTitle: [
        {
          width: 70,
          title: "序号",
          align: "center",
          key: "index",
          render: (h, params) => {
            return h(
              "span",
              params.index + (this.param.page - 1) * this.param.pagesize + 1
            );
          },
        },
        {
          title: "下单人",
          key: "publisher",
          align: "center",
          maxWidth: 125,
          minWidth: 125,
        },
        {
          title: "订单号",
          key: "id",
          align: "center",
          minWidth: 180,
        },
        {
          title: "下单时间",
          key: "ctime",
          align: "center",
          minWidth: 180,
        },
        {
          title: "车牌号",
          key: "car_number",
          align: "center",
          maxWidth: 120,
          minWidth: 120,
        },
        {
          title: "保险公司",
          key: "insurename",
          align: "center",
          maxWidth: 140,
          minWidth: 140,
        },
        {
          title: "所属车队",
          key: "fleetname",
          align: "center",
          maxWidth: 120,
          minWidth: 120,
        },
        {
          title: "救援区域",
          key: "start_town",
          align: "center",
          maxWidth: 120,
          minWidth: 120,
        },
        {
          title: "救援类型",
          key: "rescue_type_name",
          align: "center",
          maxWidth: 120,
          minWidth: 120,
        },
        {
          title: "付款类型",
          key: "balance_type",
          align: "center",
          maxWidth: 120,
          minWidth: 120,
          render: (h, params) => {
            let text = params.row.balance_type == 0 ? "现结" : "月结";
            return h("span", text);
          },
        },
        {
          title: "到达时间",
          key: "confirm_time",
          align: "center",
          minWidth: 180,
        },
        {
          title: "完成时间",
          key: "arrive_time",
          align: "center",
          minWidth: 180,
        },
        {
          title: "到达公里数 (km)",
          key: "arrive_km",
          align: "center",
          maxWidth: 110,
          minWidth: 110,
        },
        {
          title: "施救公里数 (km)",
          key: "real_km",
          align: "center",
          maxWidth: 110,
          minWidth: 110,
        },
        {
          title: "车辆类型",
          key: "cartype_name",
          align: "center",
          maxWidth: 150,
          minWidth: 150,
        },
        {
          title: "金额",
          key: "money",
          align: "center",
          maxWidth: 80,
          minWidth: 80,
        },
        {
          title: "状态",
          key: "status_name",
          maxWidth: 100,
          minWidth: 100,
        },
        {
          title: "终点是否异常",
          key: "abnormal_end",
          align: "center",
          maxWidth: 90,
          minWidth: 90,
          render:(h,params) => {
            let text = params.row.abnormal_end == 1?'是':'否'
            return h('span',text)
          }
        },
        {
          title: "客服备注",
          key: "admin_memo",
          maxWidth: 160,
          minWidth: 160,
        },
        {
          title: "操作",
          slot: "action",
          align: "center",
          minWidth: 160,
          fixed: "right",
        },
      ],
      tableTitle2: [
        {
          width: 70,
          title: "序号",
          align: "center",
          key: "index",
          render: (h, params) => {
            return h(
              "span",
              params.index + (this.param.page - 1) * this.param.pagesize + 1
            );
          },
        },
        {
          title: "下单人",
          key: "publisher",
          align: "center",
          maxWidth: 125,
          minWidth: 125,
        },
        {
          title: "下单人联系方式",
          key: "publisher_mobile",
          align: "center",
          maxWidth: 120,
          minWidth: 120,
        },
        {
          title: "订单号",
          key: "id",
          align: "center",
          minWidth: 180,
        },
        {
          title: "下单时间",
          key: "ctime",
          align: "center",
          minWidth: 180,
        },
        {
          title: "报案号",
          key: "case_number",
          align: "center",
          maxWidth: 150,
          minWidth: 150,
        },
        {
          title: "车牌号",
          key: "car_number",
          align: "center",
          maxWidth: 120,
          minWidth: 120,
        },
        {
          title: "联系人",
          key: "nickname",
          align: "center",
          maxWidth: 125,
          minWidth: 125,
        },
        {
          title: "联系人电话",
          key: "mobile",
          align: "center",
          maxWidth: 125,
          minWidth: 125,
        },
        {
          title: "申报备注",
          key: "admin_memo",
          align: "center",
          maxWidth: 160,
          minWidth: 160,
        },
        {
          title: "保险公司",
          key: "insurename",
          align: "center",
          maxWidth: 140,
          minWidth: 140,
        },
        {
          title: "所属车队",
          key: "fleetname",
          align: "center",
          maxWidth: 120,
          minWidth: 120,
        },
        {
          title: "接单司机",
          key: "fleet_user_name",
          align: "center",
          maxWidth: 120,
          minWidth: 120,
        },
        {
          title: "司机电话",
          key: "fleet_user_mobile",
          align: "center",
          maxWidth: 130,
          minWidth: 130,
        },
        {
          title: "救援区域",
          key: "start_town",
          align: "center",
          maxWidth: 120,
          minWidth: 120,
        },
        {
          title: "救援地点",
          key: "start_address",
          align: "center",
          maxWidth: 180,
          minWidth: 180,
        },
        {
          title: "拖车终点",
          key: "end_address",
          align: "center",
          maxWidth: 180,
          minWidth: 180,
        },
        {
          title: "确认终点",
          key: "driver_address",
          align: "center",
          maxWidth: 180,
          minWidth: 180,
        },
        {
          title: "接单时间",
          key: "receive_time",
          align: "center",
          minWidth: 180,
        },
        {
          title: "救援类型",
          key: "rescue_type_name",
          align: "center",
          maxWidth: 120,
          minWidth: 120,
        },
        {
          title: "付款类型",
          key: "balance_type",
          align: "center",
          maxWidth: 120,
          minWidth: 120,
          render: (h, params) => {
            let text = params.row.balance_type == 0 ? "现结" : "月结";
            return h("span", text);
          },
        },
        {
          title: "到达时间",
          key: "confirm_time",
          align: "center",
          minWidth: 180,
        },
        {
          title: "完成时间",
          key: "arrive_time",
          align: "center",
          minWidth: 180,
        },
        {
          title: "到达公里数 (km)",
          key: "arrive_km",
          align: "center",
          maxWidth: 110,
          minWidth: 110,
        },
        {
          title: "预计公里数 (km)",
          key: "km",
          align: "center",
          maxWidth: 110,
          minWidth: 110,
        },
        {
          title: "施救公里数 (km)",
          key: "real_km",
          align: "center",
          maxWidth: 110,
          minWidth: 110,
        },
        {
          title: "车辆类型",
          key: "cartype_name",
          align: "center",
          maxWidth: 150,
          minWidth: 150,
        },
        {
          title: "金额",
          key: "money",
          align: "center",
          maxWidth: 80,
          minWidth: 80,
        },
        {
          title: "保险费用",
          key: "insure_money",
          align: "center",
          maxWidth: 70,
          minWidth: 70,
        },
        {
          title: "车队费用",
          key: "fleet_money",
          align: "center",
          maxWidth: 70,
          minWidth: 70,
        },
        {
          title: "施救方式",
          key: "finish_type_name",
          align: "center",
          maxWidth: 120,
          minWidth: 120,
        },
        {
          title: "状态",
          key: "status_name",
          maxWidth: 100,
          minWidth: 100,
        },
        {
          title: "客服备注",
          key: "admin_memo",
          maxWidth: 160,
          minWidth: 160,
        },
        {
          title: "操作",
          slot: "action",
          align: "center",
          minWidth: 160,
          fixed: "right",
        },
      ],
      tableData: [],
      total: null,
      total2: null,
      lookInfo: {
        showModal: false,
        title: "",
        disabled: false,
      },
      rowList: {},
      lookInfo2: {
        showModal: false,
        title: "",
      },
      rowList2: {},
      lookInfo3: {
        showModal: false,
        title: "",
      },
      rowList3: {},
      lookInfo4: {
        showModal: false,
        title: "",
      },
      rowList4: {},
      companyList: [],
      carTeamList: [],
      userList: [],
      allTableData: [],
      orderList: [],
      fangkongParam: {
        page: 1,
        pagesize: 10,
        start_time: "",
        end_time: "",
        uid: null,
        fleet_id: null,
        type:1
      },
      fangkongList: [],
      fangkongTitle: [
        {
          width: 70,
          title: "序号",
          align: "center",
          key: "index",
          render: (h, params) => {
            return h(
              "span",
              params.index +
                (this.fangkongParam.page - 1) * this.fangkongParam.pagesize +
                1
            );
          },
        },
        {
          title: "订单号",
          key: "order_id",
          align: "center",
        },
        {
          title: "司机名称",
          key: "driver_name",
          align: "center",
        },
        {
          title: "司机放空照片",
          key: "operating_pic",
          align: "center",
          render: (h, params) => {
            return h(
              "span",
              {
                on: {
                  click: () => {
                    this.imgs = params.row.operating_pic.split(",");
                    this.value1 = 0
                    this.oepnSlider = true;
                  },
                },
                style:{
                  color:"rgb(64, 158, 255)",
                  cursor: "pointer",
                }
              },
              "查看"
            );
          },
        },
        {
          title: "车队名称",
          key: "fleet_name",
          align: "center",
        },
        {
          title: "放空时间",
          key: "ctime",
          align: "center",
        },
        {
          title: "放空备注",
          key: "memo",
          align: "center",
        },
        {
          title: "到达公里数",
          key: "distance",
          align: "center",
        },
      ],
      overTimeTitle:[
        {
          width: 70,
          title: "序号",
          align: "center",
          key: "index",
          render: (h, params) => {
            return h(
              "span",
              params.index +
                (this.fangkongParam.page - 1) * this.fangkongParam.pagesize +
                1
            );
          },
        },
        {
          title: "订单号",
          key: "order_id",
          align: "center",
        },
        {
          title: "司机名称",
          key: "driver_name",
          align: "center",
        },
        {
          title: "车队名称",
          key: "fleet_name",
          align: "center",
        },
        {
          title: "超时时间",
          key: "ctime",
          align: "center",
        },
      ],
      abnormalTitle:[
        {
          width: 70,
          title: "序号",
          align: "center",
          key: "index",
          render: (h, params) => {
            return h(
              "span",
              params.index +
                (this.fangkongParam.page - 1) * this.fangkongParam.pagesize +
                1
            );
          },
        },
        {
          title: "订单号",
          key: "oid",
          align: "center",
        },
        {
          title: "下单人",
          key: "uid",
          align: "center",
        },
        {
          title: "下单人名称",
          key: "username",
          align: "center",
        },
        {
          title: "下单时间",
          key: "order_ctime",
          align: "center",
        },
        {
          title: "地点限制状态",
          key: "limit_status",
          align: "center",
          render:(h,params) => {
            let text = params.row.limit_status == 0?'待解除':'已解除'
            return h('span',text)
          }
        },
        {
          title: "保险公司",
          key: "insurename",
          align: "center",
        },
        {
          title: "车牌号",
          key: "car_number",
          align: "center",
        },
        {
          title: "车队",
          key: "fleetname",
          align: "center",
        },
        {
          title: "司机",
          key: "drivername",
          align: "center",
        },
        {
          title: "操作",
          slot: "action",
          align: "center",
        }
      ],

      abnormalParam:{
        page:1,
        pagesize:10,
        keyword:"",
      },
      abnormalList:[],
      driverList: [],
      value1: 0,
      oepnSlider: false,
      imgs: [],
    };
  },
  mixins: [mxRadioRoot],
  //监听属性 类似于data概念
  computed: {},
  //监控data中的数据变化
  watch: {},
  //方法集合
  methods: {
    //   获取救援施救列表
    getRescueHistoryList() {
      return new Promise((resolve, reject) => {
        $ajax.rescueorderList(this.param, (res) => {
          if (this.param.pagesize != 10000) {
            this.tableData = res.data.list;
            this.total = res.data.total;
          } else {
            this.allTableData = res.data.list;
          }
          resolve();
        });
      });
    },
    // 获取放空列表
    getFangKongList() {
      return new Promise((resolve,reject) => {
        $ajax.fangkong_list(this.fangkongParam, (res) => {
          if (this.fangkongParam.pagesize != 10000) {
            this.fangkongList = res.data.list;
            this.total2 = res.data.total;
          } else {
            this.allTableData = res.data.list;
          }
          resolve();
        });
      })
    },
    // 获取确认现场异常记录列表
    getAbnormalList(){
      $ajax.confirmYichang_list(this.abnormalParam,res=>{
        console.log(res)
        this.abnormalList = res.data.list;
        this.total = res.data.total
      })
    },
    // 切换tap栏
    switchTap(name) {
      this.fangkongParam.page = 1
      this.fangkongParam.start_time = ""
      this.fangkongParam.end_time = ""
      this.fangkongParam.fleet_id = null
      this.fangkongParam.uid = null
      // this.abnormalParam.page = 1
      this.param.page = 1
      if (name == "name2") {
        this.fangkongParam.type = 1
        this.getFangKongList();
      } else if (name == "name1") {
        this.getRescueHistoryList();
      }else if(name == 'name3'){
        this.fangkongParam.type = 2
        this.getFangKongList();
      }else if(name == 'name4'){
        this.getAbnormalList()
      }
    },
    // 获取订单状态
    getOrderList() {
      $ajax.get_orderAllStatus(
        { token: localStorage.getItem("token") },
        (res) => {
          this.orderList = res.data;
        }
      );
    },
    // 获取保险公司列表
    getInsureListList() {
      $ajax.insureList({ token: localStorage.getItem("token") }, (res) => {
        let data = res.data.list;
        this.companyList = data;
      });
    },

    // 获取车队公司列表
    getCarTeamCompany() {
      $ajax.carTeamList({ page: 1, pagesize: 999 }, (res) => {
        this.carTeamList = res.data.list;
      });
    },

    // 获取司机列表
    getDriverList() {
      $ajax.fleetWokerList(
        { page: 1, pagesize: 999, fleet_id: this.fangkongParam.fleet_id },
        (res) => {
          this.driverList = res.data.list;
        }
      );
    },
    // 选择车队
    selectCarTeam(value) {
      this.fangkongParam.uid = null;
      this.driverList = [];
      if (this.fangkongParam.fleet_id) {
        this.getDriverList();
      }
    },
    // 选择时间
    selectDate(date) {
      this.param.start_time = date[0];
      this.param.end_time = date[1];
    },
    // 选择时间
    selectDate2(date) {
      this.fangkongParam.start_time = date[0];
      this.fangkongParam.end_time = date[1];
    },
    // 添加数据
    addData() {
      this.lookInfo4.showModal = true;
      this.lookInfo4.title = "添加";
    },
    // 查看详情
    lookDetail(row) {
      this.rowList = JSON.parse(JSON.stringify(row)); //解决修改数据的时候,表格也跟着变化的问题
      this.lookInfo.showModal = true;
      this.lookInfo.title = "详情";
    },
    //   搜索
    searchData() {
      this.param.page = 1;
      this.getRescueHistoryList();
    },
    //   搜索
    searchData2() {
      this.fangkongParam.page = 1;
      this.getFangKongList();
    },
    //   搜索
    searchData3() {
      this.abnormalParam.page = 1;
      this.getAbnormalList();
    },
    // 编辑数据
    updateData(row) {
      this.rowList3 = JSON.parse(JSON.stringify(row)); //解决修改数据的时候,表格也跟着变化的问题
      this.lookInfo3.showModal = true;
      this.lookInfo3.title = "编辑";
    },
    // 指派
    assign(row) {
      this.rowList2 = JSON.parse(JSON.stringify(row)); //解决修改数据的时候,表格也跟着变化的问题
      this.lookInfo2.showModal = true;
      this.lookInfo2.title = "指派";
    },
    //取消
    cancel(id) {
      let obj = {};
      obj.yesFun = () => {
        $ajax.orderCancel({ id: id }, (res) => {
          $app.toast(res.msg, true, () => {
            this.getRescueHistoryList();
          });
        });
      };
      $app.confirm("确定要取消吗", "提示", obj);
    },
    // 解除异常
    relieve(id){
      let obj = {};
      obj.yesFun = () => {
        $ajax.confirmYichang_remove({ id: id }, (res) => {
          $app.toast(res.msg, true, () => {
            this.getAbnormalList();
          });
        });
      };
      $app.confirm("确定要解除异常吗", "提示", obj);
    },
    // 导出数据
    exportData() {
      this.param.page = 1;
      this.param.pagesize = 10000;
      this.getRescueHistoryList().then((res) => {
        if (this.allTableData.length == 0) {
          $app.toast("没有数据,无法导出", false);
        } else {
          this.$refs.myTable.exportCsv({
            filename: "救援列表",
            original: false,
            columns: this.tableTitle2,
            data: this.allTableData.map((k, index) => {
              k.balance_type = k.balance_type == 0 ? "现结" : "月结";
              k.index = index + 1;
              if(k.finish_type_name){
                k.finish_type_name =  k.finish_type_name.replace(/,/g, " ");
              }
              this.param.pagesize = 10;
              return k;
            }),
          });
        }
      });
    },
    exportData2(){
      this.fangkongParam.page = 1;
      this.fangkongParam.pagesize = 10000;
      this.getFangKongList().then((res)=>{
        if (this.allTableData.length == 0) {
          $app.toast("没有数据,无法导出", false);
        } else {
          this.$refs.myTable.exportCsv({
            filename: "放空列表",
            original: false,
            columns: this.fangkongTitle,
            data: this.allTableData.map((k, index) => {
              k.index = index + 1;
              k.operating_pic = k.operating_pic.replace(/,/g, " ")
              this.fangkongParam.pagesize = 10;
              return k;
            }),
          });
        }
      })
    },
    exportData3(){
      this.fangkongParam.page = 1;
      this.fangkongParam.pagesize = 10000;
      this.getFangKongList().then((res)=>{
        if (this.allTableData.length == 0) {
          $app.toast("没有数据,无法导出", false);
        } else {
          this.$refs.myTable.exportCsv({
            filename: "超时列表",
            original: false,
            columns: this.overTimeTitle,
            data: this.allTableData.map((k, index) => {
              k.index = index + 1;
              this.fangkongParam.pagesize = 10;
              return k;
            }),
          });
        }
      })
    },
    // 分页页码
    switchPageIndex(index) {
      this.param.page = index;
      this.getRescueHistoryList();
    },
    // 分页条数
    switchPageSize(pageSize) {
      this.param.pagesize = pageSize;
      this.getRescueHistoryList();
    },
    // 分页页码
    switchPageIndex2(index) {
      this.fangkongParam.page = index;
      this.getFangKongList();
    },
    // 分页条数
    switchPageSize2(pageSize) {
      this.fangkongParam.pagesize = pageSize;
      this.getFangKongList();
    },
    // 分页页码
    switchPageIndex3(index) {
      this.abnormalParam.page = index;
      this.getAbnormalList();
    },
    // 分页条数
    switchPageSize3(pageSize) {
      this.abnormalParam.pagesize = pageSize;
      this.getAbnormalList();
    },
  },
  //生命周期 - 创建完成（可以访问当前this实例）
  created() {
    this.getRescueHistoryList();
    this.getInsureListList();
    this.getCarTeamCompany();
    this.getOrderList();
    let id = this.$route.query.id || "";
    this.param.keyword = id;
  },
  //生命周期 - 挂载完成（可以访问DOM元素）
  mounted() {},
  beforeCreate() {}, //生命周期 - 创建之前
  beforeMount() {}, //生命周期 - 挂载之前
  beforeUpdate() {}, //生命周期 - 更新之前
  updated() {}, //生命周期 - 更新之后
  beforeDestroy() {}, //生命周期 - 销毁之前
  destroyed() {}, //生命周期 - 销毁完成
  activated() {}, //如果页面有keep-alive缓存功能，这个函数会触发
};
</script>
<style lang='less' scoped>
//@import url(); 引入公共css类
@import url("../../css/companyManage/user.less");
.content {
  // background-color: #f5f7f9 !important;
}
.maskModal {
  width: 100%;
  height: 100%;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 999;
  background-color: rgba(55,55,55,.6);
}
.slideshow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80%;
  z-index: 1000;
}
</style>